<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex align-stretch benben-position-layout flex orderPromotion_flex_0" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex align-center justify-between flex-sub orderPromotion_fd0_0'>
					<view class='flex align-center orderPromotion_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
						<text class='fu-iconfont2  orderPromotion_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex align-center'>
						<text class='orderPromotion_fd0_0_c1_c0'>订单明细</text>
					</view>
					<view class='flex align-center justify-end orderPromotion_fd0_0_c0'
						@tap.stop="popupShow1692180741207=true">
						<image class='orderPromotion_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"309.png"'></image>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---推广订单-推广flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
				<!-- <view>
					<benben-flex-tabs class-name='orderPromotion_benbenTabsfd1_0' v-model="tabs" ref="benben_tabsfd1_0"
						select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false'
						:open-sticky='true' :top='88' :is-show-content='false' :scrollspy='false'
						:tabs-info.sync="tabsInfofd1_0" @change="initialization">

						<scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
							class="benben-tabs" style="width:750rpx" :scroll-x="true"
							:scroll-left.sync="tabsInfofd1_0.moveX" scroll-with-animation="all .3s ease">
							<view class="benben-tabs-content" id="benben_tabsfd1_0-content">
								<view id="benben_tabsfd1_0-title"
									class="benben-tabs-title flex flex align-center justify-around">
									<view
										:class="{ 'checkTitlefd1_0': tabs == '0', 'flex flex-wrap align-center': true }"
										@tap="tabs = '0'" :id="`benben_tabsfd1_0-title-item-${'0'}`">

										<text>{{$t('全部')}}</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_0': tabs == '1', 'flex flex-wrap align-center': true }"
										@tap="tabs = '1'" :id="`benben_tabsfd1_0-title-item-${'1'}`">

										<text>{{$t('已付款')}}</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_0': tabs == '2', 'flex flex-wrap align-center': true }"
										@tap="tabs = '2'" :id="`benben_tabsfd1_0-title-item-${'2'}`">

										<text>已完成</text>

									</view>
								</view>
								<view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
									id="benben_tabsfd1_0-line"
									class="benben-tabs-line flex benben-flex-tabs-line orderPromotion_linefd1_0"></view>
							</view>
						</scroll-view>

					</benben-flex-tabs>

				</view> -->
				<view class="loading_css" v-if="isShow">
					<u-loading size="36" color="#3090FF"></u-loading>
					<view>加载中</view>
				</view>
				
				<view class='flex flex-direction flex-wrap align-stretch orderPromotion_fd1_1' v-else>
					<template v-for='(item,key0) in list'>
						<view class='flex flex-direction flex-wrap align-stretch orderPromotion_fd1_1_c0' :key='key0'>
							<view class='flex flex-wrap align-center'>
								<image class='orderPromotion_fd1_1_c0_c0_c0' mode="aspectFill" :src='item.avatar'>
								</image>
								<text class='flex-sub orderPromotion_fd1_1_c0_c0_c1'>{{item.nickname}}</text>
								<text class='orderPromotion_fd1_1_c0_c0_c2'></text>
							</view>
							<view class='flex flex-wrap align-center flex-sub orderPromotion_fd1_1_c0_c1'>
								<view class='flex flex-wrap align-stretch orderPromotion_fd1_1_c0_c1_c0'>
									<view class='orderPromotion_fd1_1_c0_c1_c0_c0'>
										<u-lazy-load :image="item.thumb" border-radius="16" height="200" img-mode="aspectFill"></u-lazy-load>
									</view>
									<view
										class='flex flex-direction align-stretch flex-sub orderPromotion_fd1_1_c0_c1_c0_c1'>
										<text class='orderPromotion_fd1_1_c0_c1_c0_c1_c0'>{{item.title}}</text>
										<view class='flex flex-wrap align-center orderPromotion_fd1_1_c0_c1_c0_c1_c1'>
											<text
												class='orderPromotion_fd1_1_c0_c1_c0_c1_c1_c0'>{{item.synopsis}}</text>
										</view>
									</view>
								</view>
							</view>
							<view class='flex flex-wrap align-center orderPromotion_fd1_1_c0_c2'>
								<text>{{$t('收益等级：')}}</text>
								<text>{{item.type == 1 ? '直推' : '间推'}}收益</text>
							</view>
							<view class='flex flex-wrap align-center orderPromotion_fd1_1_c0_c2'>
								<text>{{$t('订单编号：')}}</text>
								<text>{{item.order_sn}}</text>
							</view>
							<view class='flex flex-wrap align-center orderPromotion_fd1_1_c0_c4'>
								<text>{{$t('下单时间：')}}</text>
								<text>{{item.show_time}}</text>
							</view>
							<view class='flex flex-wrap align-center justify-between orderPromotion_fd1_1_c0_c5'>
								<view class='flex flex-wrap align-center'>
									<text class='orderPromotion_fd1_1_c0_c5_c0_c0'>{{$t('订单实付金额:')}}</text>
									<text class='orderPromotion_fd1_1_c0_c5_c0_c0'>{{$t('￥')}}</text>
									<text class='orderPromotion_fd1_1_c0_c5_c0_c0'>{{item.real_money}}</text>
								</view>
								<view class='flex flex-wrap align-center'>
									<text class='orderPromotion_fd1_1_c0_c5_c1_c0'>{{$t('预计收益')}}</text>
									<text class='orderPromotion_fd1_1_c0_c5_c1_c1'>{{$t('￥')}}</text>
									<text class='orderPromotion_fd1_1_c0_c5_c1_c2'>{{item.commision}}</text>
								</view>
							</view>
						</view>
					</template>
					<view class="loadmore" v-if="last_page > 1">
						<u-loadmore font-size="24" :status="status" :icon-type="iconType" :load-text="loadText" />
					</view>
				</view>
				<view class="noData" v-if="list.length == 0 && !isShow">
					<image :src='STATIC_URL+"no.png"'></image>
				</view>
			</view>

			<!---推广订单-推广flex布局结束-->
			<benben-popup v-model="popupShow1692180741207" :mask="true" :mask-close-able="true" mode='center'>
				<!---flex布局flex布局开始-->
				<view class="flex benben-flex-layout flex-wrap align-center">
					<benben-calendar-diy mode='range' year-arrow-color='#666666' month-arrow-color='#666666'
						start-text='' end-text=' ' active-bg-color='rgba(41,121,255,1)'
						range-bg-color='rgba(41,121,255,0.13)' :change-title='true' :change-year='true'
						:change-month='true' class='orderPromotion_fd2_0' @change="initialization"
						:start-time.sync="start_time" :end-time.sync="end_time"></benben-calendar-diy>
				</view>

				<!---flex布局flex布局结束-->

			</benben-popup>


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},

		data() {
			return {
				"popupShow1692180741207": false,
				"tabsInfofd1_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0
				},
				"tabs": "0",
				"type": "2",  // 1本月  2全部
				"start_time": "",
				"end_time": "",
				
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				type
			} = options
			if (type !== undefined) this.type = type;
			if (this.type == 1) {
				this.dateTransFunc();
			} else {
				this.getList();
			}
			
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
		
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getList();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			//计算每月的时间
			dateTransFunc() {
				let date = new Date()
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
				
				month = (month > 9) ? month : ("0" + month);
				day = (day < 10) ? ("0" + day) : day;
				this.end_time = year + "-" + month + "-" + day;
				this.start_time = year + "-" + month + "-01";
				this.getList();
			},
			getList() {
				this.$api.post(global.apiUrls.post658aa82193137, {
					page: this.page,
					start_time: this.start_time,
					end_time: this.end_time
				}).then(res => {
					uni.stopPullDownRefresh();
					this.isShow = false;
					// console.log(res);
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			initialization() {
				this.popupShow1692180741207 = false;
				this.page = 1;
				this.is_pull = true;
				this.isShow = true;
				this.getList();
			}
		}
	};
</script>
<style lang="scss" scoped>
	/deep/.u-lazy-item {
		width: 200rpx !important;
		height: 200rpx !important;
	}
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.orderPromotion_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.orderPromotion_fd0_0_c2_c0 {
		width: 36rpx;
		height: 36rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.orderPromotion_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
	}

	.orderPromotion_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.orderPromotion_fd0_0_c0 {
		width: 180rpx;
	}

	.orderPromotion_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.orderPromotion_fd1_1_c0_c5_c1_c2 {
		color: rgba(255, 70, 32, 1);
		font-size: 32rpx;
		font-weight: 700;
		line-height: 42rpx;
	}

	.orderPromotion_fd1_1_c0_c5_c1_c1 {
		color: rgba(255, 70, 32, 1);
		font-size: 20rpx;
		font-weight: 700;
		line-height: 42rpx;
	}

	.orderPromotion_fd1_1_c0_c5_c1_c0 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 42rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.orderPromotion_fd1_1_c0_c5_c0_c0 {
		color: rgba(153, 153, 153, 1);
		font-size: 24rpx;
		font-weight: 400;
		line-height: 42rpx;
	}

	.orderPromotion_fd1_1_c0_c5 {
		padding: 24rpx 0rpx 32rpx 0rpx;
	}

	.orderPromotion_fd1_1_c0_c4 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		color: #999999;
		font-size: 24rpx;
		line-height: 42rpx;
		font-weight: 400;
		padding: 0rpx 0rpx 24rpx 0rpx;
	}

	.orderPromotion_fd1_1_c0_c2 {
		color: #999999;
		font-size: 24rpx;
		line-height: 42rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.orderPromotion_fd1_1_c0_c1_c0_c1_c1_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		line-height: 33rpx;
	}

	.orderPromotion_fd1_1_c0_c1_c0_c1_c1 {
		margin: 16rpx 0rpx 30rpx 0rpx;
		color: #999999;
		font-size: 24rpx;
		line-height: 33rpx;
		font-weight: 400;
	}

	.orderPromotion_fd1_1_c0_c1_c0_c1_c0 {
		font-size: 28rpx;
		font-weight: 500;
		color: #333333;
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		line-height: 42rpx;
	}

	.orderPromotion_fd1_1_c0_c1_c0_c1 {
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.orderPromotion_fd1_1_c0_c1_c0_c0 {
		width: 200rpx;
		height: 200rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.orderPromotion_fd1_1_c0_c1_c0 {
		margin: 24rpx 0rpx 24rpx 0rpx;
	}

	.orderPromotion_fd1_1_c0_c1 {
		background: #fff;
		background-size: 100% auto !important;
	}

	.orderPromotion_fd1_1_c0_c0_c2 {
		color: rgba(255, 103, 86, 1);
		font-size: 28rpx;
		font-weight: 500;
		line-height: 40rpx;
	}

	.orderPromotion_fd1_1_c0_c0_c1 {
		color: rgba(102, 102, 102, 1);
		font-size: 24rpx;
		font-weight: 400;
		line-height: 40rpx;
		margin: 0rpx 0rpx 0rpx 18rpx;
	}

	.orderPromotion_fd1_1_c0_c0_c0 {
		width: 40rpx;
		height: 40rpx;
		border-radius: 50%;
	}

	.orderPromotion_fd1_1_c0 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 32rpx 19rpx 0rpx 24rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.orderPromotion_fd1_1 {
		padding: 24rpx 24rpx 0rpx 24rpx;
	}

	.orderPromotion_linefd1_0 {
		background: var(--benbenbgColor0);
		width: 40rpx;
		height: 8rpx;
		top: 80rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx;
	}

	.checkTitlefd1_0 {
		font-weight: 700 !important;
		font-size: 32 !important;
		color: #101010 !important;
		background-color: rgba(255, 255, 255, 1) !important;
	}

	::v-deep .orderPromotion_benbenTabsfd1_0 {
		background: #fff;
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		text-align: center;
		font-size: 32rpx;
		font-weight: 400;
		color: rgba(167, 166, 167, 1);
	}

	.orderPromotion_fd2_0 {
		background: #ffffff;
		width: 640rpx;
		border-radius: 24rpx;
		margin: 012rpx 012rpx 012rpx 012rpx;
	}
</style>